﻿using BenCaoXuan.Infrastructure.Attr;
using BenCaoXuan.Infrastructure.Dto;
using BenCaoXuan.Service.Interface.admin;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BenCaoXuan.Api.Admin.Controllers.admin
{
    [ApiGroup("Admin(管理端模块)")]
    public class OrderController : BaseController
    {
        private readonly I_Order_Service _order_Service;

        public OrderController(I_Login_Service login_Service, I_Order_Service order_Service) : base(login_Service)
        {
            _order_Service = order_Service;
        }



        /// <summary>
        /// 管理端-获取所有订单
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Orders(int page = 1, int limit = 10, string? key = "") {
            var result = await _order_Service.Get_Order(new Fenye_Dto() { 
            page=page,
            limit=limit,
            key=key??""
            });
            return Ok(result);
        }

        /// <summary>
        /// 管理端-获取单个订单详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Single_Order(string? id) {
            var result = await _order_Service.Get_Single_Order(id);
            return Ok(result);
        }

        /// <summary>
        /// 管理端-获取所有的房间
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Room() {
            var result = await _order_Service.Get_Room();
            return Ok(result);
        }

        /// <summary>
        /// 管理端-获取当前房间的客户
        /// </summary>
        /// <param name="roomID"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Room_Customer(string? roomID) {
            var result = await _order_Service.Get_Room_Customer(roomID);
            return Ok(result);
        }

      
    }
}
